﻿namespace WMS6.Web.Outbound
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.UserControls;

    public class BatchOrderQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlCreatedByOper;
        protected DropDownList ddlDescriptionOper;
        protected DropDownList ddlExternalWaveID;
        protected DropDownList ddlStatusOper;
        protected DropDownList ddlWaveID;
        protected HtmlForm F7030;
        protected HtmlInputHidden hdnActionID;
        protected Label lblbatchOrderQuery;
        protected Label lblCreatedBy;
        protected Label lblDescription;
        protected Label lblExternalWaveID;
        protected Label lblStatus;
        protected Label lblWaveID;
        protected MultipleSelectControl MSCStatus;
        protected HtmlLink mycss;
        protected TextBox txtCreatedBy;
        protected TextBox txtDescription;
        protected TextBox txtExternalWaveID;
        protected TextBox txtWaveID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("BatchOrderList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("BatchOrderList.aspx?action=" + base.UrlEncode(this.hdnActionID.Value), false);
        }

        private void LoadDDl()
        {
            base.InitQueryDDL(this.ddlExternalWaveID, 0);
            base.InitQueryDDL(this.ddlWaveID, 0);
            base.InitQueryDDL(this.ddlStatusOper, 0);
            base.InitQueryDDL(this.ddlDescriptionOper, 0);
            base.InitQueryDDL(this.ddlCreatedByOper, 0);
            base.BindData2DDLBySysCode(this.MSCStatus, "WaveStatus");
            this.ddlStatusOper.SelectedValue = "One Of";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDDl();
            }
        }

        public string CreatedBy
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCreatedBy.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCreatedBy.Text.Trim(), this.ddlCreatedByOper.SelectedValue);
                }
                return "";
            }
        }

        public string Description
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDescription.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDescription.Text.Trim(), this.ddlDescriptionOper.SelectedValue);
                }
                return "";
            }
        }

        public string ExternalWaveID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternalWaveID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternalWaveID.Text.Trim(), this.ddlExternalWaveID.SelectedValue);
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCStatus.ReturnValue))
                {
                    return base.GetParamsString(this.MSCStatus.ReturnValue, this.ddlStatusOper.SelectedValue);
                }
                return "";
            }
        }

        public string WaveID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtWaveID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtWaveID.Text.Trim(), this.ddlWaveID.SelectedValue);
                }
                return "";
            }
        }
    }
}

